home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-M68K / IO.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  78 lines

  1. #ifndef _M68K_IO_H
  2. #define _M68K_IO_H
  3.  
  4. #ifdef __KERNEL__
  5.  
  6. #include <linux/config.h>
  7.  
  8. #ifdef CONFIG_ATARI
  9. #include <asm/atarihw.h>
  10.  
  11. #define SLOW_DOWN_IO    do { if (MACH_IS_ATARI) MFPDELAY(); } while (0)
  12. #endif
  13.  
  14. #include <asm/virtconvert.h>
  15.  
  16. /*
  17.  * readX/writeX() are used to access memory mapped devices. On some
  18.  * architectures the memory mapped IO stuff needs to be accessed
  19.  * differently. On the m68k architecture, we just read/write the
  20.  * memory location directly.
  21.  */
  22. /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
  23.  * two accesses to memory, which may be undesireable for some devices.
  24.  */
  25. #define readb(addr) \
  26.     ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
  27. #define readw(addr) \
  28.     ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
  29. #define readl(addr) \
  30.     ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
  31.  
  32. #define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
  33. #define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
  34. #define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
  35.  
  36. #define memset_io(a,b,c)    memset((void *)(a),(b),(c))
  37. #define memcpy_fromio(a,b,c)    memcpy((a),(void *)(b),(c))
  38. #define memcpy_toio(a,b,c)    memcpy((void *)(a),(b),(c))
  39.  
  40. #define inb_p(addr) readb(addr)
  41. #define inb(addr) readb(addr)
  42.  
  43. #define outb(x,addr) ((void) writeb(x,addr))
  44. #define outb_p(x,addr) outb(x,addr)
  45.  
  46.  
  47. /* Values for nocacheflag and cmode */
  48. #define IOMAP_FULL_CACHING        0
  49. #define IOMAP_NOCACHE_SER        1
  50. #define IOMAP_NOCACHE_NONSER        2
  51. #define IOMAP_WRITETHROUGH        3
  52.  
  53. extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
  54. extern void __iounmap(void *addr, unsigned long size);
  55.  
  56. extern inline void *ioremap(unsigned long physaddr, unsigned long size)
  57. {
  58.     return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  59. }
  60. extern inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
  61. {
  62.     return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  63. }
  64. extern inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size)
  65. {
  66.     return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
  67. }
  68. extern inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
  69. {
  70.     return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
  71. }
  72.  
  73. extern void iounmap(void *addr);
  74.  
  75. #endif /* __KERNEL__ */
  76.  
  77. #endif /* _M68K_IO_H */
  78.